"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
//封装 可以把类内部属性隐藏起来，不让外部访问
// 1.可以提高易用性
// 2.可以保护类的隐私
var Animal = /** @class */ (function () {
    function Animal(name, age, weight) {
        this.name = name;
        this.age = age;
        this.weight = weight;
    }
    //static静态属性，直接用类点语法访问，其他不可访问
    Animal.sex = '男';
    return Animal;
}());
;
var Person = /** @class */ (function (_super) {
    __extends(Person, _super);
    function Person(name, age, weight, balance) {
        var _this = _super.call(this, name, age, weight) || this;
        _this.balance = balance;
        return _this;
    }
    ;
    Person.prototype.getName = function () {
        return this.name; //可以取得
    };
    ;
    Person.prototype.getAge = function () {
        return this.age; //可以取得
    };
    ;
    Person.prototype.getWeight = function () {
        // return this.weight  不能取得，因为是private私有的
    };
    return Person;
}(Animal));
var p1 = new Person('小李', 33, '60kg', 99);
p1.name; //可以取得
// p1.age 不能取得，因为是protected的
// p1.weight 不能取得，因为是private的
